package com.wkq.util.transformer

import android.view.View
import androidx.viewpager2.widget.ViewPager2

/**
 *
 *@Author: wkq
 *
 *@Time: 2025/7/30 10:09
 *
 *@Desc: RotateDownPageTransformer 实现
 */
class RotateDownPageTransformer : ViewPager2.PageTransformer {
    override fun transformPage(page: View, position: Float) {
        val rotation = -15f * position // 旋转角度可调

        page.pivotX = page.width * 0.5f
        page.pivotY = 0f // 顶部为旋转中心
        page.rotation = rotation

        // 可选: 控制透明度或缩放让效果更自然
        page.alpha = 1 - Math.abs(position * 0.5f)
    }
}
